package com.solution.framework.util;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ZTreeModel {
    private Serializable id;
    private Serializable pid;
    private String name;
    private boolean open;
    private boolean isParent ;
    private Map<String,String> attributes=new HashMap<String, String>();
    private List<ZTreeModel> children = new ArrayList<ZTreeModel>();

    public Serializable getPid() {
        return pid;
    }

    public void setPid(Serializable pid) {
        this.pid = pid;
    }

    public Serializable getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Map<String, String> getAttributes() {
        return attributes;
    }

    public void setAttributes(Map<String, String> attributes) {
        this.attributes = attributes;
    }

    public List<ZTreeModel> getChildren() {
        return children;
    }

    public void setChildren(List<ZTreeModel> children) {
        this.children = children;
    }

    public static ZTreeModel getRoot(String name){
        ZTreeModel zTreeModel = new ZTreeModel();
        zTreeModel.setId(0l);
        zTreeModel.setPid(null);
        zTreeModel.setName(name);
        zTreeModel.setOpen(true);
        zTreeModel.setParent(false);
        return zTreeModel;
    }

    public boolean isOpen() {
        return open;
    }

    public void setOpen(boolean open) {
        this.open = open;
    }

    public boolean isParent() {
        return isParent;
    }

    public void setParent(boolean parent) {
        isParent = parent;
    }
}
